﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Liebrand.UrlShortener.Tracer;
using System.Reflection;

namespace Liebrand.UrlShortener
{
    public static class Utilities
    {

        #region Methods

        public static string GenerateHash(string url)
        {
            var hashCode = url.ToLower().GetHashCode();
            return string.Format("{0:X}", hashCode).ToLower();
        }

        public static void WriteError(string message)
        {
            TraceProvider.RegisterTraceProvider();
            TraceProvider.WriteTrace(TraceProvider.TagFromString("LSUS"), TraceProvider.TraceSeverity.High, Guid.Empty, Assembly.GetCallingAssembly().FullName, "LiebrandUrlShortener", "LiebrandUrlShortener", message);
            TraceProvider.UnregisterTraceProvider();
        }

        #endregion

 
    }
}